<template>
  <div class="mod-menu">
    <el-form :inline="true" :model="pamars">
      <el-form-item label="提现单号">
        <el-input
          v-model="pamars.business_code"
          placeholder="提现单号"
          clearable
        ></el-input>
      </el-form-item>
      <el-form-item label="提现状态">
        <el-select v-model="pamars.remit_status" clearable placeholder="请选择">
          <el-option
            v-for="item in options"
            :key="item.value"
            :label="item.label"
            :value="item.value"
          >
          </el-option>
        </el-select>
      </el-form-item>
      <el-form-item>
        <el-button @click="getDataList()">查询</el-button>
      </el-form-item>
    </el-form>
    <el-table :data="dataList" row-key="Id" border style="width: 100%; ">
      <el-table-column prop="business_code" align="center" label="提现单号">
      </el-table-column>

      <el-table-column prop="money" align="center" label="提现金额">
      </el-table-column>
      <el-table-column prop="payment_term" align="center" label="收款方式">
        <template slot-scope="scope">
          <div v-if="scope.row.payment_term == 0">微信</div>
          <div v-if="scope.row.payment_term == 1">支付宝</div>
          <div v-if="scope.row.payment_term == 2">银行线下</div>
          <div v-if="scope.row.payment_term == 3">现金支付</div>
        </template>
      </el-table-column>
      <el-table-column align="center" label="提现方式">
        <template slot-scope="scope">
          <div>{{ scope.row.payee }}</div>
          <div>{{ scope.row.withdraw_mobile }}</div>
          <div v-if="scope.row.bank_name">{{ scope.row.bank_name }}</div>
          <div>{{ scope.row.withdraw_account }}</div>
        </template>
      </el-table-column>
      <el-table-column prop="commission_cost" align="center" label="提现手续费">
      </el-table-column>
      <el-table-column prop="verify_status" align="center" label="审核状态">
        <template slot-scope="scope">
          <el-tag type="warning" v-if="scope.row.verify_status === 0"
            >待审核</el-tag
          >
          <el-tag type="success" v-if="scope.row.verify_status == 1"
            >审核通过</el-tag
          >
          <el-popover trigger="hover" placement="top">
            <p v-if="scope.row.verify_opinion">
              {{ scope.row.verify_opinion }}
            </p>
            <div slot="reference">
              <el-tag type="danger" v-if="scope.row.verify_status == 2"
                >审核不通过</el-tag
              >
            </div>
          </el-popover>
        </template>
      </el-table-column>
      <el-table-column
        prop="remit_status"
        align="center"
        :formatter="statusFormatter"
        label="提现状态"
      >
      </el-table-column>
      <el-table-column prop="create_time" align="center" label="申请时间">
      </el-table-column>
      <el-table-column prop="third_pay_code" align="center" label="交易单号">
        <template slot-scope="scope">{{
          scope.row.third_pay_code ? scope.row.third_pay_code : '暂无'
        }}</template>
      </el-table-column>
      <el-table-column prop="remit_time" align="center" label="打款日期">
        <template slot-scope="scope">{{
          scope.row.remit_time ? scope.row.remit_time : '暂无'
        }}</template>
      </el-table-column>
    </el-table>
    <el-pagination
      @size-change="sizeChangeHandle"
      @current-change="currentChangeHandle"
      :current-page="pamars.page"
      :page-sizes="[10, 20, 50, 100]"
      :page-size="pamars.limit"
      :total="totalPage"
      layout="total, sizes, prev, pager, next, jumper"
    ></el-pagination>
  </div>
</template>

<script>
import seviceApi from '@/api/serviceApi.js'
export default {
  data() {
    return {
      dataForm: {},
      pamars: {
        page: 1,
        limit: 10,
        mobile: '',
        shop_name: ''
      },
      totalPage: 0,
      dataList: [],
      options: [
        {
          value: 0,
          label: '未打款'
        },
        {
          value: 1,
          label: '已打款'
        }
      ],
      dataListLoading: false,
      addOrUpdateVisible: false
    }
  },
  components: {},
  mounted() {
    this.getList()
  },
  methods: {
    getList() {
      seviceApi.getWithdrawShopList(this.pamars).then(res => {
        if (res && res.data.code == 200) {
          this.dataList = res.data.page.list
          this.totalPage = res.data.page.totalCount
        }
      })
    },
    // 每页数
    sizeChangeHandle(val) {
      this.pamars.limit = val
      this.getList()
    },
    // 当前页
    currentChangeHandle(val) {
      this.pamars.page = val
      this.getList()
    },
    // 查询
    getDataList() {
      this.pamars.page = 1
      this.getList()
    },
    // 提现状态
    statusFormatter(row, column) {
      let status = row.remit_status
      if (status == false) {
        return '未打款'
      } else {
        return '已打款'
      }
    }
  }
}
</script>
